﻿using BusinessLayer.Dal;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace Biz
{
    public enum OrderStatus
    {
        PAID,
        UN_PAID
    }

    public class Order
    {
        [Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }
        public DateTime Time { get; set; }
        public string CustomerName { get; set; }
        public string CustomerAddress { get; set; }
        public string CustomerEmail { get; set; }
        public string CustomerPhone { get; set; }
        public OrderStatus Status { get; set; }
        public virtual List<OrderedProduct> Products { get; set; }


        OrderDal dal = new OrderDal();
        public List<Order> GetAll()
        {
            return dal.GetAll();
        }
        public void Insert(Cart cart)
        {
            dal.Insert(this,cart);
        }
        public List<Order> GetByCondition(DateTime from, DateTime to,int status)
        {
            return dal.GetByCondition(from, to,status);
        }

        public void Update()
        {
            dal.Update(this);
        }
    }
}